package com.chat.comment.core;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseResult<T> {
    private int status;
    private String msg;
    private T data;
    private String source;

    public ResponseResult(int status, String msg, T data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public static <T> ResponseResult<T> success() {
        return new ResponseResult<>(2000, "ok", null);
    }
    public static <T> ResponseResult<T> success(T data) {
        return new ResponseResult<>(2000, "ok", data);
    }

    public static <T> ResponseResult<Object> upate(String message, T data) {
        return new ResponseResult<>(30000, message, data);
    }

    public static ResponseResult<Object> error(String message) {
        return new ResponseResult<>(10000, message, null);
    }

    public static ResponseResult<Object> info(String message) {
        return new ResponseResult<>(20000, message, null);
    }
}
